import os
import re


# 把 相对路径 转换成 绝对路径
class DirMetaClass(type):
    abs_path = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))

    def __new__(cls, name, bases, attrs, **kwargs):
        for k, v in attrs.items():
            if not re.match(r'__.+?__$', k):
                v = cls.abs_path + v
                attrs[k] = v
        return type.__new__(cls, name, bases, attrs, **kwargs)
